package com.yuanchu.store.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description: 通过 FeignAuthClient 来调用 oauth/token 内部接口获取登录认证令牌
 * @date: 2024-01-18 16:05
 */
@FeignClient(value = "yuanchu-auth", fallbackFactory = FeignAuthServiceClientFallbackFactory.class)
public interface FeignAuthClient {

/*
    @PostMapping("/auth/oauth/token")
    Map<String,Object> postAccessToken(@RequestParam MultiValueMap<String, String> parameters,
                           @RequestHeader MultiValueMap<String, String> headers);

    @RequestMapping(method = RequestMethod.POST, value = "/oauth/token", headers = {"Content-Type: multipart/form-data", "Authorization=Basic "})
    Map<String,Object> generateToken(@RequestBody MultiValueMap<String, String> map);
*/

    @PostMapping("/auth/oauth/token")
    Map<String,String> postAccessToken(@RequestParam MultiValueMap<String, String> parameters);

    @PostMapping("/auth/oauth/token")
    Map<String,Object> postAccessToken2(@RequestParam MultiValueMap<String, String> parameters);
/*
    @PostMapping("/auth/oauth/loginTwo")
    <T> Result<T> postAccessTokenTwo(@RequestBody AuthParamsDto params);
*/


    @PostMapping("/auth/oauth/logout")
    void outAccessToken(@RequestHeader MultiValueMap<String, String> headers);

}
